package com.yunji.coupon.enums;

import lombok.Getter;

/**
 * @author : peter-zhu
 * @date : 2024/10/23 18:46
 * @description : TODO
 **/
@Getter
public enum CouponTypeEnum {
    PLATE(1, "平台优惠券"),
    NEW_REGISTER(2, "新人优惠券");
    private final Integer code;
    private final String desc;

    CouponTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(Integer code) {
        CouponTypeEnum[] values = CouponTypeEnum.values();
        for (CouponTypeEnum value : values) {
            if (value.getCode().equals(code)) {
                return value.getDesc();
            }
        }
        return null;
    }
}
